from manim import *

class Comment1Animation(Scene):
    def construct(self):
        part1 = Text("这个产品真的太棒了", font_size=36, color=BLUE)
        part2 = Text("它的设计非常精美", font_size=36, color=PURPLE)
        part3 = Text("功能也很强大", font_size=36, color=ORANGE)
        part4 = Text("完全超出了我的预期", font_size=48, color=GREEN)

        part1.move_to(LEFT * 3)
        part2.next_to(part1, RIGHT, buff=0.2)
        part3.next_to(part2, RIGHT, buff=0.2)
        part4.next_to(part3, RIGHT, buff=0.2)

        self.play(FadeIn(part1))
        self.wait()
        self.play(FadeIn(part2))
        self.wait()
        self.play(FadeIn(part3))
        self.wait()
        self.play(FadeIn(part4))
        self.wait()

        # 实现“强大”闪烁效果
        for _ in range(3):
            self.play(part3[2:].animate.set_opacity(0.5))
            self.wait()
            self.play(part3[2:].animate.set_opacity(1))
            self.wait()

        # 实现最后一句放大旋转效果
        self.play(part4.animate.scale(1.5).rotate(15 * DEGREES))
        self.wait()
        self.play(part4.animate.scale(1).rotate(0))
        self.wait()

if __name__ == "__main__":
    from manim import config
    config.media_width = "1920"
    config.media_height = "1080"
    config.frame_rate = 30
    config.output_file = "comments_animation.mp4"

    with tempconfig({"quality": "high_quality", "preview": False}):
        scene_classes = [Comment1Animation, Comment2Animation,...]  # 依次添加所有评论的场景类
        for scene_class in scene_classes:
            scene = scene_class()
            scene.render()